<template>
<section>
  <router-link to="/staticasset/check/addCheck">
      <el-button round type="primary"  size="small" icon="el-icon-plus">新增盘点单</el-button>
  </router-link> 
   <el-button round type="primary" @click="dialogFormVisible = true"  size="small" ><font-awesome-icon :icon="['fas','sign-out-alt']"/>导出</el-button> 
        
     <el-table
      v-loading="listLoading"
    border
    ref="multipleTable"
    :data="tableData"
    tooltip-effect="dark"
    style="width: 100%;margin-top:10px;"
    @selection-change="handleSelectionChange">
    <el-table-column
      type="selection">
    </el-table-column>
    <el-table-column
      prop="assetNum"
      label="盘点编号"
      width="120">
    </el-table-column>
    <el-table-column 
      prop="assetName"
      label="盘点名称"
      width="120"
      show-overflow-tooltip>
    </el-table-column>
    <el-table-column
      label="状态" 
      prop="status"
      width="70">
    </el-table-column>
    <el-table-column
      label="创建人" 
      prop="status"
      width="70">
    </el-table-column>
   <el-table-column
      label="盘点负责人" 
      prop="status"
      width="70">
    </el-table-column>
    <el-table-column
      prop="crateTime"
      label="创建时间"
      show-overflow-tooltip>
    </el-table-column>
  </el-table>
   <el-col :span="24" class="toolbar">
        <el-pagination
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
        :current-page="currentPage"
        :page-sizes="[20, 50, 100, 200]"
        :page-size="pageSize"
        layout="total, sizes, prev, pager, next, jumper"
        :total="totalNum">
        </el-pagination>
    </el-col> 
</section>
   
</template>

<script>
import api from "@/service/api";
import http from "@/service/http";
export default {
  data() {
    return {
      listLoading: false,
      pageSize: 20,
      totalNum: 0,
      currentPage: 1,
      tableData: []
    };
  },
  methods: {
    handleSelectionChange(val) {
      console.log(`val`);
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
      this.pageSize = val;
      this.getInboundList();
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
      this.currentPage = val;
      this.getInboundList();
    },
    getInboundList() {
      this.listLoading = true;
      var search = { pageNum: this.currentPage, pageSize: this.pageSize };
      http.post(api.sysApi.getInboundList, search).then(data => {
        if(!data.success){
				return;
			}
        this.tableData = data.data;
        this.totalNum = data.totalNum;
        this.listLoading = false;
      });
    }
  },
  mounted() {
    this.getInboundList();
  }
};
</script>

<style>
.el-pagination {
  float: right;
}
</style>
